<template>
  <div>
    <h1>App</h1>
    <p>count:{{ count }}</p>
    <button @click="increment">累加count</button>
    <button @click="incrementN({ n: 2 })">累加N count</button>
    <button @click="decrement">累减count</button>
  </div>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
export default {
  name: 'App',
  mounted() {
    console.log(this, 'app');
    const result = mapMutations(['increment', 'decrement', 'incrementN']);
    console.log(result);
  },
  computed: {
    ...mapState(['count', 'num']),
  },
  methods: {
    ...mapMutations(['increment', 'decrement', 'incrementN']),
  }, // increment() {
  //   // 提交mutations
  //   this.$store.commit('increment');
  // },
  // decrement() {
  //   this.$store.commit('decrement');
  // },
  // incrementN(payload) {
  //   this.$store.commit('incrementN', payload);
  // },
};
</script>
<style></style>
